<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<script type="text/javascript">
	$(function() {
		validReg("updateForm");
	});
</script>
<div id="page-content" class="page-content" >
		
	<div class="page-content-wrapper">
				<div class="page-content" ms-controller="userModify">
					<!--content-->
					<div class="containerTop">
						<a href="javascript:;" class="a-back" onclick="menuUrl('user/view', 'user:page');"><span class="icon-back"></span></a>
						<span>修改虚拟用户</span>
					</div>
					
					<div class="panel charger">
						<form id="updateForm" class="form-horizontal" role="form" >
							<input type="hidden" name="id" class="form-control" value="${result.data.id }">
				
							<input id="oldStatus" type="hidden"  value="${result.data.status }">
							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>用户姓名：</div>
								<div class="col-sm-10 ">
									<div class="pr">
										<input type="text"  name="userName" readonly="readonly" class="form-control" placeholder="请输入用户姓名" required data-bv-notempty data-bv-regexp="true" data-bv-regexp="true" data-bv-regexp-message="请输入1-16个中文、英文字母或数字" pattern="^[A-Za-z0-9\u4E00-\u9FA5 \,]{1,16}$" value="${result.data.userName }">
									</div>
								</div>
							</div>
							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>登录名：</div>
								<div class="col-sm-10">
									<div class="pr">
										<input type="text" name="account"  readonly="readonly" class="form-control" placeholder="请输入登录名" required data-bv-notempty data-bv-regexp="true" data-bv-regexp-message="请输入1-16个英文字母、数字或下划线(_)" pattern="^[A-Za-z0-9_]{1,16}$" value="${result.data.account }">
									</div>
								</div>
							</div>

							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>办公电话：</div>
								<div class="col-sm-10">
									<div class="pr">
										<input type="text" name="officePhone" class="form-control" placeholder="请输入办公电话" value="${result.data.officePhone }" required data-bv-notempty data-bv-phone="true" data-bv-phone-country="CN" data-bv-phone-message="例如：0769-12345678">
									</div>		
								</div>
							</div>

							<div class="form-group">
								<label class="left-label text-right col-sm-2 col-xs-12">手机号码：</label>
								<div class="col-sm-10">
									<div class="pr">
										<input type="text" name="phone" class="form-control" placeholder="请输入手机号码"  value="${result.data.phone }" data-bv-phone="true" data-bv-phone-country="CN" data-bv-phone-message="例如：13999999999"/>
									</div>
								</div>
							</div>

							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>所属机构：</div>
								<div class="col-sm-10">
									<select name="corpId" id="corpId"  onchange="user.getRoleByCorp('corpId','numbResult')" class="form-control input-sm" required data-bv-notempty>
									</select>
									
								</div>
							</div>
							<div class="form-group" id="numbResult" style="display: none;">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>角色权限：</div>
								<div class="col-sm-10 content">
								</div>
							</div>
							<script type="text/javascript">
							
								var arr = [];
								<c:forEach items="${result.data.useRoleList}" var ="row" varStatus="status">
							 	  arr.push("${row.roleId}");
							 	</c:forEach>
							    user.addCorpItem("corpId","${result.data.corpId }", "numbResult", arr);
							</script>
							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>所属部门：</div>
								<div class="col-sm-10">
									<select name="deptId" id="deptId" class="form-control input-sm" required data-bv-notempty>
									</select>
								</div>
							</div>
							
							<script type="text/javascript">
							    user.addDeptItem("deptId","${result.data.deptId }");
							</script>
							<div id="realUserDiv">
								<div class="form-group">
									<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>真实用户：</div>
									<div class="col-sm-10" name="realUserId" id="realUserId">
										<!-- <select name="realUserId" id="realUserId" class="form-control input-sm" required data-bv-notempty>
										</select> -->
										<!-- <input type="checkbox" name="realUserId" id="realUserId"  required data-bv-notempty> -->
									</div>
								</div>
								<script type="text/javascript">
								user.addRealUserItem("${result.data.id}","update");
								</script>
								<div class="form-group">
									<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>查询次数：</div>
									<div class="col-sm-10">
										<input type="number" name="limitCount" class="form-control" value="${result.data.limitCount }" placeholder="" required data-bv-notempty style="width: 150px;"  max="100000">
										<span>&nbsp;次/天</span>	
									</div>
								</div>
							</div>
							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>IP设置：</div>
								<div class="col-sm-10">
									<input type="text" name="allowIp" class="form-control" value="${result.data.allowIp }" placeholder="可添加多个IP，IP间用英文“;”隔开" required data-bv-notempty data-bv-ips>
								</div>
							</div>
							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12"><span class="col_red">*</span>mac地址：</div>
								<div class="col-sm-10">
									<input type="text" name="userMac" class="form-control" value="${result.data.userMac}" placeholder="" required data-bv-notempty id="userMac">
								</div>
							</div>
							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12">所属IP段：</div>
								<div class="col-sm-10">
									<input type="text" name="startRange" value="${result.data.startRange }"  class="form-control" placeholder="请添加IP"  style="width: 120px;" data-bv-ip>
									<span>—</span>	
									<input type="text" name="endRange" value="${result.data.endRange }" class="form-control" placeholder="请添加IP"  style="width: 120px;" data-bv-ip>
								</div>
							</div>
							<div class="form-group">
								<div class="left-label text-right col-sm-2 col-xs-12">备注：</div>
								<div class="col-sm-10">
									<!--<input type="text" class="form-control" placeholder="请输入办公电话">-->
									<textarea name="note" class="form-control" rows="3" data-bv-stringlength-max="500"  data-bv-stringlength="true">${result.data.note }</textarea>
								</div>
							</div>
							
							<div class="imgUploadBox">
								<ul>
									<li>
										<h5>头像采集</h5>
										<p>
											<a href="javascript:void(0);" class="a-btn1 grey" :click="@scan(1)">拍摄头像</a>
										</p>
										<div id="face"></div>
										<p>
											<img  src="<c:if test='${empty result.data.certifiedHeadUrl}'>resources/skins/img/img2.jpg</c:if><c:if test='${not empty result.data.certifiedHeadUrl}'>file/download?id=${result.data.certifiedHeadUrl}&sid=${sid}</c:if> " id="certifiedHeadUrl" width="313" height="175"/>
											<input type="hidden" id="certifiedHeadUrlId" value="${result.data.certifiedHeadUrl}"  name="certifiedHeadUrl"/>
										</p>
									</li>
									<li>
										<h5>身份证正面</h5>
										<p>
											<img src="<c:if test='${empty result.data.idcardFrontUrl}'>resources/skins/img/img3.jpg</c:if><c:if test='${not empty result.data.idcardFrontUrl}'>file/download?id=${result.data.idcardFrontUrl}&sid=${sid}</c:if>" id="idcardFrontUrl" width="313" height="175"/>
											<input type="hidden" id="idcardFrontUrlId" value="${result.data.idcardFrontUrl}" name="idcardFrontUrl" />
										</p>
									</li>
									<li>
										<h5>身份证反面</h5>
										<p>
											<img src="<c:if test='${empty result.data.idcardBackUrl}'>resources/skins/img/img4.jpg</c:if><c:if test='${not empty result.data.idcardBackUrl}'>file/download?id=${result.data.idcardBackUrl}&sid=${sid}</c:if>" id="idcardBackUrl" width="313" height="175"/>
											<input type="hidden" value="${result.data.idcardBackUrl}" id="idcardBackUrlId" name="idcardBackUrl"/>
										</p>
									</li>
									<li>
										<p>
											<a href="javascript:void(0);" class="a-btn1 grey" :click="@readIdCard">读取二代身份证</a>
										</p>
									</li>
								</ul>
							</div>
								
							<div class="text-center opareBtm">

							<button type="button"   class="a-btn1" onclick="validateCallback(this, user.uploadPhoto,'','modify')">确定</button>
						 	<button type="button" onclick="menuUrl('user/view', 'user:page');" class="a-btn1 grey">返回</button>
		
							</div>
						</form>
						
						
						
					</div>
					
					<!--end content-->
				</div>
			</div>

<div class="clearfix"></div>
</div>
<script src="resources/js/app/user/userModify.js"></script>